package cn.kgc.springmvc.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author: mosin
 * @version: v1.0  2022/5/6
 */
@ControllerAdvice
public class GloableExceptionController {

    @ExceptionHandler(ArithmeticException.class)
    public  String  exeptionHandler1(Exception e){
        System.out.println("error msg:"+e.getMessage());
        return  "redirect:/static/error1.jsp";
    }

    @ExceptionHandler(NullPointerException.class)
    public  String  exeptionHandler2(Exception e){
        System.out.println("error msg:"+e.getMessage());
        return  "redirect:/static/error2.jsp";
    }

}
